<template>
  <div class="app-container home">
    <div class="wallpage"></div>
    
    <!-- 透明介绍框 -->
    <div class="intro-box">
      <h1 class="school-title">欢迎来到青岛城市学院</h1>
      <div class="school-intro">
        <p>致力于培养优秀人才的现代化教育机构，拥有先进的教学设施和专业的教师团队。</p>
      </div>
    </div>
    
    <!-- 快捷入口 -->
    <div class="quick-nav">
      <div class="nav-ball" @click="navigateTo">
        <div class="ball-text">快捷入口</div>
      </div>
    </div>
  </div>
</template>

<script setup>
import useUserStore from "@/store/modules/user.js";
import {useRouter} from "vue-router";
import Cookies from "js-cookie";
import { User, Bell, Setting } from '@element-plus/icons-vue'

const router = useRouter()
const userInfo = useUserStore()

function init() {
  if (userInfo.roles.findIndex(item => item == 'common') > -1 && Cookies.get('allowAdminIndex') == "false") {
    router.push('/userIndex');
  }
}

function navigateTo() {
  router.push("/userIndex/home");
  // window.location.reload();
}

init()
</script>

<style lang="scss" scoped>
.app-container.home {
  position: relative;
  width: 100%;
  height: 100vh;
  overflow: hidden;
}

.wallpage {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: url("../assets/login/login.jpg") no-repeat center center;
  background-size: cover;
  z-index: -1;
}

/* 透明介绍框样式 */
.intro-box {
  position: absolute;
  top: 70%;
  left: 50%;
  transform: translate(-50%, -60%);
  width: 100%;
  max-width: 100%;
  padding: 40px;
  background-color: rgba(255, 255, 255, 0.518);
  border-radius: 15px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(5px);
  text-align: center;
  animation: fadeIn 1.5s ease-in-out;
  
  .school-title {
    font-size: 36px;
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 20px;
    letter-spacing: 2px;
  }
  
  .school-intro {
    font-size: 18px;
    line-height: 1.8;
    color: #34495e;
    
    p {
      margin-bottom: 15px;
    }
  }
}

/* 快捷入口样式 */
.quick-nav {
  position: absolute;
  top: 30%;
  right: 50px;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 30px;
  animation: slideRight 1s ease-in-out;
  
  .nav-title {
    font-size: 18px;
    color: white;
    font-weight: bold;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    margin-bottom: 10px;
    text-align: center;
  }
  
  .nav-ball {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
    
    &:hover {
      transform: translateX(-10px);
      
      .ball-text {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        box-shadow: 
          0 15px 30px rgba(102, 126, 234, 0.4),
          0 5px 15px rgba(0, 0, 0, 0.2),
          inset 0 -3px 0 rgba(0, 0, 0, 0.2);
      }
    }
    
    .ball-text {
      padding: 12px 20px;
      border-radius: 20px;
      background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
      display: flex;
      justify-content: center;
      align-items: center;
      transition: all 0.3s ease;
      box-shadow: 
        0 10px 20px rgba(102, 126, 234, 0.3),
        0 3px 10px rgba(0, 0, 0, 0.2),
        inset 0 -2px 0 rgba(0, 0, 0, 0.2);
      position: relative;
      font-size: 16px;
      color: white;
      font-weight: 500;
      text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    }
  }
}

/* 动画效果 */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translate(-50%, -70%);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -60%);
  }
}

@keyframes slideRight {
  from {
    opacity: 0;
    transform: translateY(-50%) translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
  }
}

/* 响应式设计 */
@media (max-width: 768px) {
  .intro-box {
    width: 100%;
    padding: 30px 20px;
    
    .school-title {
      font-size: 28px;
    }
    
    .school-intro {
      font-size: 16px;
    }
  }
  
  .quick-nav {
    right: 20px;
    gap: 20px;
    
    .nav-title {
      font-size: 16px;
    }
    
    .nav-ball {
      .ball-text {
        font-size: 14px;
        padding: 10px 16px;
      }
    }
  }
}
</style>
